var vm = new Vue({
    el: '#app',
    data: {
        list:[
        ],
        start:0,
        end:10,
        isNoMore:false,
        text:'加载更多'
    },
    mounted: function () {
        this.$nextTick(function () {
            this.getData();
        })
    },
    methods: {
        getData: function () {
            if(vm.isNoMore){
                return
            }
            var urlPrefix ='http://192.168.1.128:8080/renren-fast';
            var token = '9ba2299ca6469acf95d685fddfd81b5c';
            var url = urlPrefix+"/lottery/fccomplaint/list?token="+token+"&start="+vm.start+"&end="+vm.end;

            vm.text = '加载中...';
            axios.get(url)
                .then(function (response) {
                    var code = response.data.code;
                    console.log(code);
                    if(code==0){
                        console.log(response.data.list.length);
                        if(response.data.list==null || response.data.list.length<1){
                            vm.isNoMore = true;
                            vm.text = '没有更多数据了';
                        }else{
                            vm.list=vm.list.concat(response.data.list);
                            vm.start+=10;
                            vm.end+=10;
                            vm.text = '加载更多';
                        }
                    }
                })
                .catch(function (error) {
                    console.log(error);
                });
        }
    }
});

